
public class NetworkNode {
	
	public int destination;
	public int distance;
	
	//Default Constructor
	public NetworkNode() {
		destination = 0;
		distance = 0;
	}
	
	//Constructor with parameters
	public NetworkNode(int nodeID, int weight) {
		destination = nodeID;
		distance = weight;
	}
	
	//Constructor with parameters
	//Input a string with two integers (i.e. "X Y") delimited by a single space.
	//Set the destination to X and the distance to Y.
	public NetworkNode(String nodeAsString) {
		nodeAsString.trim();
		try {
			destination = Integer.valueOf(nodeAsString.substring(0, 1));
			distance =  Integer.valueOf(nodeAsString.substring(2, 3));
		} catch(Exception eRef) {
			System.err.println("Error: Parameter nodeAsString given in improper format: " + nodeAsString);
			System.err.println("Setting default field values for this node.");
			destination = 0;
			distance = 0;
		}
	}
	//This is the best keyboard in the world!
	public String nodeToString() {
		return destination + " " + distance;
	}
	public String toString(){
		return nodeToString();
	}
}
